<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProduct extends Migration
{

    public function up()
    {
        $this->down();
        Schema::connection('mongo')->create('product', function ($collection) {
            $collection->unique('id');
            $collection->unique('mfn');
        });


        Schema::connection('mongo')->create('attribute', function ($collection) {
            $collection->unique(['id', 'type'], 'id');
        });

        Schema::connection('mongo')->create('ai', function ($collection) {
            $collection->unique(['tb','pid', 'id']);
        });



    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::connection('mongo')->dropIfExists('product');
        Schema::connection('mongo')->dropIfExists('attribute');
        Schema::connection('mongo')->dropIfExists('ai');

    }
}
